<?php

namespace App\Http\Requests\V3_2_7;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class SetTimeRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules(): array
    {
        return [
            'set_time'=>'required|date_format:Y-m-d',
            'set_type'=>['required',Rule::in([0,1])]
        ];
    }

    /**
     * 验证错误信息.
     *
     * @return array
     */
    public function messages(): array
    {
        return [
            'set_time.required' => '设置时间,不能为空',
            'set_time.date_format' => '设置时间格式错误，如：2024-08-08',
            'set_type.required' => '设置类型,不能为空',
            'set_type.in' => '设置类型错误！',
        ];
    }
}
